home *** CD-ROM | disk | FTP | other *** search
/ Merciful 4 / Merciful - Disc 4.iso / rexx / animtoframes.pprx < prev    next >
Text File  |  1996-11-01  |  3KB  |  120 lines

  1. /* Personal Paint Amiga Rexx script - Copyright © 1995-1996 Cloanto Italia srl */
  2.  
  3. /* $VER: AnimToFrames.pprx 1.1 */
  4.  
  5. /** ENG
  6.   This script converts the current animation into separate frames, creating
  7.   a file for each frame. A three-digit suffix after the user-specified
  8.   file name indicates the position of each frame in the animation, starting
  9.   from frame 1. For example, if the name "Animation" is selected, the first
  10.   frame will be saved as "Animation.001".
  11. */
  12.  
  13. /** DEU
  14.   Dieses Skript wandelt die aktuelle Animation in Einzelbilder um, wobei
  15.   für jedes Bild eine eigene Datei erstellt wird. Die Position eines
  16.   Bildes innerhalb der Gesamtanimation wird durch eine dreistellige
  17.   Dateiendung wiedergegeben, beginnend mit Bild 1. Beispiel: Wird als
  18.   Name "Animation" festgelegt, so erhält das als erstes gespeicherte
  19.   Einzelbild den Dateinamen "Animation.001".
  20. */
  21.  
  22. IF ARG(1, EXISTS) THEN
  23.     PARSE ARG PPPORT
  24. ELSE
  25.     PPPORT = 'PPAINT'
  26.  
  27. IF ~SHOW('P', PPPORT) THEN DO
  28.     IF EXISTS('PPaint:PPaint') THEN DO
  29.         ADDRESS COMMAND 'Run >NIL: PPaint:PPaint'
  30.         DO 30 WHILE ~SHOW('P',PPPORT)
  31.              ADDRESS COMMAND 'Wait >NIL: 1 SEC'
  32.         END
  33.     END
  34.     ELSE DO
  35.         SAY "Personal Paint could not be loaded."
  36.         EXIT 10
  37.     END
  38. END
  39.  
  40. IF ~SHOW('P', PPPORT) THEN DO
  41.     SAY 'Personal Paint Rexx port could not be opened'
  42.     EXIT 10
  43. END
  44.  
  45. ADDRESS VALUE PPPORT
  46. OPTIONS RESULTS
  47. OPTIONS FAILAT 10000
  48.  
  49. Get 'LANG'
  50. IF RESULT = 1 THEN DO        /* Deutsch */
  51.     txt_req_load      = 'Animation auswählen'
  52.     txt_req_sel       = 'Format und Namensstamm auswählen'
  53.     txt_err_abort     = 'Speichervorgang wurde abgebrochen'
  54.     txt_err_save      = 'Fehler beim Speichern: '
  55.     txt_err_oldclient = 'Für dieses Skript_ist eine neuere Version_von Personal Paint erforderlich'
  56. END
  57. ELSE IF RESULT = 2 THEN DO    /* Italiano */
  58.     txt_req_load      = 'Selezionare animazione'
  59.     txt_req_sel       = 'Selezionare formato e nome'
  60.     txt_err_abort     = 'Operazione annullata'
  61.     txt_err_save      = 'Errore nella scrittura: '
  62.     txt_err_oldclient = 'Questa procedura richiede_una versione più recente_di Personal Paint'
  63. END
  64. ELSE DO                /* English */
  65.     txt_req_load      = 'Select Animation'
  66.     txt_req_sel       = 'Select Format and Root Name'
  67.     txt_err_abort     = 'User abort during save'
  68.     txt_err_save      = 'Error during save: '
  69.     txt_err_oldclient = 'This script requires a newer_version of Personal Paint'
  70. END
  71.  
  72. Version 'REXX'
  73. IF RESULT < 7 THEN DO
  74.     RequestNotify 'PROMPT "'txt_err_oldclient'"'
  75.     EXIT 10
  76. END
  77.  
  78. LockGUI
  79. GetFrames
  80. frames = RESULT
  81. IF frames = 0 THEN DO
  82.     RequestFile '"'txt_req_load'"'
  83.     IF RC = 0 THEN DO
  84.         LoadAnimation RESULT 'NEW'
  85.         GetFrames
  86.         frames = RESULT
  87.     END
  88. END
  89. IF frames > 0 THEN DO
  90.     RequestFile '"'txt_req_sel'" SAVEMODE LISTFORMATS FORCE'
  91.     IF RC = 0 THEN DO
  92.         savedata = RESULT
  93.         endf = INDEX(savedata, '"', 2)
  94.         filename = SUBSTR(savedata, 2, endf - 2)
  95.         filedata = SUBSTR(savedata, endf + 1)
  96.         GetFramePosition
  97.         savepos = RESULT
  98.         errcode = 0
  99.         SetFramePosition 1
  100.         DO fnum = 1 TO frames
  101.             fname = filename || "." || RIGHT(fnum, 3, "0")
  102.             SaveImage '"'fname'"'filedata 'FORCE QUIET'
  103.             IF RC ~= 0 THEN DO
  104.                 IF RC = 5 THEN
  105.                     errmess = txt_err_abort
  106.                 ELSE
  107.                     errmess = txt_err_save || RC
  108.                 errcode = RC
  109.                 LEAVE
  110.             END
  111.             SetFramePosition 'NEXT'
  112.         END
  113.         SetFramePosition savepos
  114.  
  115.         IF errcode > 0 THEN
  116.             RequestNotify 'PROMPT "'errmess'"'
  117.     END
  118. END
  119. UnlockGUI
  120.